package my.senix.sc.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lhs on 2018/11/4.
 */
@RestController
public class SimpleController {

    @GetMapping("/hello4")
    public String hello(@RequestParam(required = false) String name){

        System.out.println("name44:"+name);

        return "hello world dadaas";
    }

    @GetMapping("/hello/*")
    public String helloWildCard(@RequestParam(required = false) String name){

        System.out.println("name44:"+name);

        return "hello world *";
    }

    @GetMapping("/hello/**")
    public String hello2WildCard(@RequestParam(required = false) String name){

        System.out.println("name44:"+name);

        return "hello world **";
    }

    @GetMapping(path="/hello",params = "name=123")
    public String testParam(@RequestParam(required = false) String name){

        System.out.println("name44:"+name);

        return "name=123";
    }

    @GetMapping("/aa")
    public String testStr(){
        if(1==1){
            throw new ArrayIndexOutOfBoundsException("超出数组范围");
        }

        return "dfaafd";
    }
}
